<template>
	<view class="content">
		<view class="card p15">
			<view class="flex">
				<image class="top-icon" src="../../static/icon/shijian1.png" mode="aspectFill"></image>
				<view class="f14"><text style="color:#656565 ;">姓名：</text><text>{{userinfo.nickname}}</text></view>
			</view>
			<view class="line">
			</view>
			<view class="flex">
				<image class="top-icon" src="../../static/icon/dizhi1.png" mode="aspectFill"></image>
				<view class="f14 row1"><text style="color:#656565 ;">联系方式：</text><text>{{userinfo.mobile}}</text></view>
			</view>
			<view class="line">
			</view>
			<view class="flex">
				<image class="top-icon" src="../../static/icon/s.png" mode="aspectFill"></image>
				<view class="f14 row1"><text style="color:#656565 ;">职称：</text><text>{{userinfo.zhicheng}}</text></view>
			</view>
			<view class="line">
			</view>
			<view class="flex">
				<image class="top-icon" src="../../static/icon/s.png" mode="aspectFill"></image>
				<view class="f14 row1"><text style="color:#656565 ;">巡检区域：</text><text>{{userinfo.xj_quyu}}</text></view>
			</view>
			<view class="line">
			</view>
			<view class="flex">
				<image class="top-icon" src="../../static/icon/s.png" mode="aspectFill"></image>
				<view class="f14 row1"><text style="color:#656565 ;">设备属性：</text><text>{{getDevice(userinfo.device)}}</text></view>
			</view>
		</view>
		<view class="card p15" style="margin-top: 20rpx;">
			<textarea v-model="desc" style="width: 100%;height: 150rpx;" placeholder="请填写申请内容"
				placeholder-style="font-size:28rpx"></textarea>
		</view>
		<view class="report card" @click="submit()">
			提交
		</view>
	</view>
</template>

<script>
	import helper from '../../common/helper.js';
	import api from '../../common/api.js';

	export default {
		components: {},
		data() {
			return {
				desc: '',
				userinfo:'',
			}
		},
		mounted() {},
		onLoad(op) {
			this.helper = helper;
			this.getUserInfo();
		},
		methods: {
			getDevice(device){
				console.log(device)
				switch (device) {
					case '0':
						return '人员';
						break;
					case '1':
						return '车辆';
						break;
					case '2':
						return '移动设备';
						break;
				}
			},
			async getUserInfo() {
				let res = await api.getUserInfo();
				this.userinfo = res.data;
			},
			//上报
			async submit() {
				var _this = this;
				var res = await api.approval(_this.desc);
				if (res.code == 1) {
					uni.showToast({
						title: res.msg,
						icon:'none',
						success() {
							uni.navigateBack()
						}
					})
				} else {
					uni.showToast({
						title: res.msg,
						icon:'none'
					})
				}
			}
		}

	}
</script>

<style scoped>
	.p15 {
		padding: 30rpx;
	}

	.card {
		background-color: #ffffff;
	}

	.top-icon {
		height: 42rpx;
		width: 42rpx;
		margin-right: 12rpx;
	}

	.camera {
		width: 60rpx;
		height: 60rpx;
		position: absolute;
		top: 50%;
		left: 50%;
		margin-top: -36rpx;
		margin-left: -34rpx;
	}

	.upload {
		width: 110rpx;
		height: 110rpx;
		border: 2rpx solid #989898;
		border-radius: 8rpx;
		text-align: center;
		position: relative;
	}

	.list-box {
		display: flex;
		flex-wrap: wrap;

	}

	.list-box>view {
		margin: 6rpx;
	}

	.selde {
		border-radius: 8rpx;
		font-size: 24rpx;
		padding: 0 30rpx;
		height: 54rpx;
		line-height: 50rpx;
		border: 1px solid #4DA9EC;
		color: #FFFFFF;
		background-color: #4DA9EC;
	}

	/* 未选择 */
	.noselde {
		border: 1px solid #959595;
		background: #FFFFFF;
		color: #959595;
		border-radius: 8rpx;
		font-size: 24rpx;
		padding: 0 30rpx;
		height: 54rpx;
		line-height: 50rpx;
	}

	.valueList {
		margin-top: 20rpx;
		padding: 20rpx;
		display: flex;
		justify-content: center;
	}

	.line {
		width: 100%;
		height: 2rpx;
		background-color: #f5f5f5;
		margin: 20rpx 0;
	}

	.report {
		position: fixed;
		bottom: 0;
		left: 0;
		right: 0;
		width: 100%;
		text-align: center;
		height: 100rpx;
		line-height: 100rpx;
		color: #4DA9EC;
		font-size: 30rpx;
		font-weight: bold;
	}
</style>